import type { PluginOption } from 'vite';
import { viteCompressionPlugin } from 'vite-auto-deploy';

/** 压缩 */
export function useViteCompression(isBuild: boolean): PluginOption {
  if (isBuild) {
    return viteCompressionPlugin({
      threshold: 1024 * 10,
      algorithm: 'gzip',
    }) as PluginOption;
  } else {
    return {} as PluginOption;
  }
}
